import { MockMethod } from 'vite-plugin-mock';
import { responseResult } from '@/utils/mock';
import { UserApi } from '@/api/module/userApi';
import { IAuth } from '@/store/types';
import axios from 'axios';
const Mock = require('mockjs');
export default [
  {
    url: '/login/getSMSCode',
    method: 'post',
    statusCode: 200,
    timeout: 1000,
    // @ts-ignore
    response: () => {
      return responseResult({});
    },
  },
  {
    url: '/login/mobile',
    method: 'post',
    statusCode: 200,
    timeout: 1000,
    // @ts-ignore
    response: () => {
      const data = {
        tokenHead: 'Bearer',
        userId: 1,
        token:
          'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0b20iLCJjcmVhdGVkIjoxNjQ4NTMyODQ1MTc0LCJleHAiOjE2NDkxMzc2NDV9.g7MUPY-XnMNRq7HU-W7UBlzB2eNTp4H9UVNfeQcqWdiUtNsGdBCo5ropJ972cXtzHpwjE4pvMc4MpM44uRNnyg',
        username: 'tom',
      } as IAuth;
      return responseResult({ data });
    },
  },
  {
    url: '/login/username',
    method: 'post',
    statusCode: 200,
    timeout: 1000,
    // @ts-ignore
    response: () => {
      const data = {
        tokenHead: 'Bearer',
        userId: 1,
        token:
          'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0b20iLCJjcmVhdGVkIjoxNjQ4NTMyODQ1MTc0LCJleHAiOjE2NDkxMzc2NDV9.g7MUPY-XnMNRq7HU-W7UBlzB2eNTp4H9UVNfeQcqWdiUtNsGdBCo5ropJ972cXtzHpwjE4pvMc4MpM44uRNnyg',
        username: 'tom',
      } as IAuth;
      return responseResult({ data });
    },
  },
  {
    url: '/user/getUserInfo',
    method: 'get',
    statusCode: 200,
    timeout: 1000,
    response: () => {
      const data = {
        id: 1,

        personName: '黎涛',

        sex: '男',

        idCard: '5001010200013144425',

        headImg:
          'http://fileupload.ylyisheng.cn/2022/03/17/8de14090-9826-4dd0-ab5c-52c0dc4b0d99.png',

        tel: '15025555997',

        address: '重庆',

        occupation: '医生',

        email: '1424242908@qq.com',

        username: 'tom',

        password: '123456',

        clinicId: 2019055012,

        registerTime: '2022-01-20T00:00:00',

        lastloginTime: null,

        isAdmin: false,

        isEnable: true,

        enabled: true,

        authorities: null,

        accountNonExpired: true,

        accountNonLocked: true,

        credentialsNonExpired: true,
      };
      return responseResult({ data });
    },
  },
  {
    url: '/user/updateUserInfo',
    method: 'PUT',
    statusCode: 200,
    timeout: 1000,
    response: () => {
      return responseResult({});
    },
  },
  {
    url: '/user/forgetPwd',
    method: 'put',
    statusCode: 200,
    timeout: 1000,
    response: () => {
      return responseResult({});
    },
  },
  {
    url: '/login/updatePwd',
    method: 'PUT',
    statusCode: 200,
    timeout: 1000,
    response: () => {
      return responseResult({});
    },
  },
] as MockMethod[];
